package myPack.GMAO.Bean;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import myPack.GMAO.Entity.SM;
import myPack.GMAO.Interface.SMInterface;

@Stateless
public class SMBean implements SMInterface
{
	@PersistenceContext
	EntityManager em;
	
	@Override
	public void ajouter(SM s) {
		em.merge(s);
	}
	@Override
	public List<SM> lister() {
		return em.createQuery("from SM").getResultList();
	}
	@Override
	public SM rechercher(int idSM) {
		return em.find(SM.class, idSM);
	}
	@Override
	public void supprimer(int idSM) {
		em.remove(em.find(SM.class, idSM));
	}
}
